package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.CourseTopic;
import com.ruoyi.system.mapper.CourseTopicMapper;
import com.ruoyi.system.service.CourseTopicService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 课程题目表(CourseTopic)服务实现类
 */
@Service("courseTopicService")
public class CourseTopicServiceImpl implements CourseTopicService {
    @Resource
    private CourseTopicMapper courseTopicMapper;

    /**
     * 通过ID 查询单条数据
     * @param courseId 主键
     * @return 实例对象
     */
    @Override
    public CourseTopic queryById(Long courseId) {
        return this.courseTopicMapper.queryById(courseId);
    }

    /**
     * 新增数据
     *
     * @param courseTopic 实例对象
     * @return 实例化对象
     */

    @Override
    public CourseTopic insert(CourseTopic courseTopic) {
        this.courseTopicMapper.insert(courseTopic);
        return courseTopic;
    }


    /**修改数据
     *
     * @param courseTopic 实例对象
     * @return 实例对象
     */
    @Override
    public CourseTopic update(CourseTopic courseTopic) {
        this.courseTopicMapper.update(courseTopic);
        return this.queryById(Long.parseLong(courseTopic.getCourseId()));
    }

}
